﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SteerOrbit : UnitySteer.Behaviors.Steering
{

    


    [SerializeField]private Transform target;
    [SerializeField]private float keepDistance; //希望保持的距离
    [SerializeField]private float speed;
    [SerializeField]private bool clockwise;
    protected override Vector3 CalculateForce()
    {
        
        float distance = (target.position - transform.position).magnitude;
        Vector3 axis = (target.position-transform.position).normalized; //指向轴心
        Vector3 tan = Vector3.Cross(Vector3.up, axis).normalized;
        axis = (float)Math.Log(distance/keepDistance)* axis;
        return speed*(axis + tan).normalized;



        throw new NotImplementedException();
    }
}
